from tools_algorithm import *


# class Solution:
#     def clearDigits(self, s: str) -> str:
#         q = []
#         for v in s:
#             if v >= "0" and v <= "9":
#                 if q:
#                     q.pop()
#             else:
#                 q.append(v)
#         return "".join(q)


# class Solution:
#     def findWinningPlayer(self, skills: List[int], k: int) -> int:
#         n = len(skills)
#         ai, av, t = 0, skills[0], 0
#         for i in range(1, n):
#             if av > skills[i]:
#                 t += 1
#             else:
#                 t = 1
#                 ai = i
#                 av = skills[i]
#             if t == k:
#                 return ai
#         return ai


class Solution:
    def maximumLength(self, nums: List[int], k: int) -> int:
        n = len(nums)
        f = [[0] * (k + 1) for _ in range(n)]
        for i,v in enumerate(nums):
            for k 
